﻿// ***********************************************************************
// Assembly         : Tx.OCC
// Author           : tianteng
// Created          : 04-29-2020
//
// Last Modified By : tianteng
// Last Modified On : 04-29-2020
// ***********************************************************************
// <copyright file="OccBRepAlgoEx.cs" company="北京腾雪科技有限责任公司">
//     Copyright © 北京腾雪科技有限责任公司 2022
// </copyright>
// <summary></summary>
// ***********************************************************************
using Occt;

namespace Tx.OCC
{
    /// <summary>
    /// Class OccBRepAlgoEx.
    /// </summary>
    public static class OccBRepAlgoEx
    {
        /// <summary>
        /// 布尔Intersection运算.
        /// 运算结果为两个图形相交部分
        /// </summary>
        /// <param name="shape1">The shape1.</param>
        /// <param name="shape2">The shape2.</param>
        /// <returns>TopoDS_Shape.</returns>
        public static TopoDS_Shape Common(this TopoDS_Shape shape1, TopoDS_Shape shape2)
        {
            return new BRepAlgoAPI_Common(shape1, shape2).Shape;
        }

        /// <summary>
        /// 布尔差运算.
        /// 扣除相交部分，并去除CUT SHAPE
        /// </summary>
        /// <param name="shape1">The shape1.</param>
        /// <param name="shape2">The shape2.</param>
        /// <returns>TopoDS_Shape.</returns>
        public static TopoDS_Shape Cut(this TopoDS_Shape shape1, TopoDS_Shape shape2)
        {
            return new BRepAlgoAPI_Cut(shape1, shape2).Shape;
        }

        /// <summary>
        /// 融合，布尔Union运算.
        /// 运算结果，是两个图形合并
        /// </summary>
        /// <param name="shape1">The shape1.</param>
        /// <param name="shape2">The shape2.</param>
        /// <returns>TopoDS_Shape.</returns>
        public static TopoDS_Shape Fuse(this TopoDS_Shape shape1, TopoDS_Shape shape2)
        {
            return new BRepAlgoAPI_Fuse(shape1, shape2).Shape;
        }

        /// <summary>
        /// 计算两个拓扑SHAPE或者两个几何的相交（交集）.
        /// </summary>
        /// <param name="shape1">The shape1.</param>
        /// <param name="shape2">The shape2.</param>
        /// <returns>TopoDS_Shape.</returns>
        public static TopoDS_Shape Section(this TopoDS_Shape shape1, TopoDS_Shape shape2)
        {
            return new BRepAlgoAPI_Section(shape1, shape2).Shape;
        }
    }
}
